Specializing virtual network device processing to avoid interrupt processing for high packet rate applications

ABSTRACT

A method of optimizing network processing in a system comprising a physical host and a set of physical network interface controllers (PNICs) is provided. The physical host includes a forwarding element. The method includes determining that a set of conditions is satisfied to bypass the forwarding element for exchanging packets between a particular data compute node (DCN) and a particular PNIC. The set of conditions includes the particular DCN being the only DCN connected to the forwarding element and the particular PNIC being the only PNIC connected to the forwarding element. The method exchanges packets between the particular DCN and the particular PNIC bypassing the forwarding element. The method determines that at least one condition in said set of conditions is not satisfied. The method utilizes the forwarding element to exchange packets between the particular DCN and the particular PNIC.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No.14/574,336, filed Dec. 17, 2014, entitled “Specializing Virtual NetworkDevice Processing to Bypass Forwarding Elements for High Packet RateApplications”, the entirety of which is incorporated by reference.

BACKGROUND

Virtualization of network devices provides many advantages invirtualized environments. It allows for sharing a single physical deviceamongst multiple virtual machines, setting resource limits (e.g., CPUfor processing, packet rate and throughput limits for isolation), packetinspection, migration of virtual machines, and enables many featuressuch as fault-tolerance and high availability. However, virtualizationof network devices also adds considerable CPU processing overheads. Insome cases, workloads show an overhead of 30% to 200% over a purelynon-virtualized implementation. High packet rate applications such asfirewalls, routers, and Dynamic Host Configuration Protocol (DHCP)servers require performance in the order of a few million to a few tensof million packets processed per second and the virtual deviceprocessing overhead limits performance to a million to a few millionpackets/sec.

Single Root IO Virtualization (SR-IOV) is a mix of hardware and softwaresolutions to support high performance networking workloads onvirtualized environments. SR-IOV allows for capabilities such as devicesharing and moving of virtual machines between different hosts on somevirtualization platforms. However, SR-IOV requires special hardware andSR-IOV enabled physical network interface controllers (PNICs) and SR-IOVcapable drivers. Implementing other virtualization features such asmemory over-commit or virtual machine fault-tolerance might requirefuture hardware and software updates while features such as packetinspection might not be possible.

BRIEF SUMMARY

Methods and systems are provided to make packet processing moreefficient for virtual network devices. Typically, a virtual machine (VM)is connected to a physical network interface controller (PNIC) through avirtual switch. For instance, the VM is connected to a port on thevirtual switch through a virtual network interface controller (VNIC).The PNIC is connected to another port on the virtual switch. The VMsends and receives packets through the PNIC. Some embodiments identify avirtual machine (VM) that consumes all traffic on a single physicalnetwork interface controller (PNIC) and is not sharing the PNIC with anyother VMs. These embodiments provide a specialization of the virtualdevice processing that bypasses the virtual switch layer and hook up thevirtual device code with the physical code. Since there is a singlesource port and a single destination port, any traffic an externalswitch routes to the PNIC reaches the VM and vice versa.

Bypassing the virtual switching layer reduces processing cost per packetby around 5%-10% and increases the packet processing abilityaccordingly. Bypassing of the virtual switch is a runtime decision. Oncea need arises for connecting the VM to the switch (e.g., when another VMis moved to the same host, port mirroring is needed to tap the packets,or any services the VM requires that needs the virtual switch), the VMis switched to use the virtual switch. The VM is transparently switchedbetween a fast path (no switching) and slow path (switching) to providethe required features of virtualization.

Some embodiments identify applications that consistently have highpacket rates. These embodiments provide a tradeoff between theprocessing resources and higher packet rates. These embodiments modifyvirtual device processing to occur in polling mode rather then interrupt(or sys-call) driven mode. Streamlining virtual device processingprovides a two-fold advantage. First, packet processing does not incurany latency. Second, the virtual backend, virtual machine monitor, guestkernel, and guest device driver for the virtual network device do nothave to execute interrupt coalescing and interrupt processing code. Theprocessing overhead is reduced by 1%-2%, increasing packet processing bya similar amount. Some embodiments turn on/off the polling mode when aVNIC is initialized (e.g., at the time of VM boot or VNIC reset). Inother embodiments, the polling mode is adaptively turned on or offduring the runtime. In these embodiments, polling is turned on whenpacket rate is high and turns off polling when the packet rate is low.

The preceding Summary is intended to serve as a brief introduction tosome embodiments of the invention. It is not meant to be an introductionor overview of all inventive subject matter disclosed in this document.The Detailed Description that follows and the Drawings that are referredto in the Detailed Description will further describe the embodimentsdescribed in the Summary as well as other embodiments. Accordingly, tounderstand all the embodiments described by this document, a full reviewof the Summary, Detailed Description and the Drawings is needed.Moreover, the claimed subject matters are not to be limited by theillustrative details in the Summary, Detailed Description and theDrawing.

BRIEF DESCRIPTION OF THE DRAWINGS

The novel features of the invention are set forth in the appendedclaims. However, for purposes of explanation, several embodiments of theinvention are set forth in the following figures.

FIG. 1 conceptually illustrates a virtualized infrastructure domain insome embodiments of the invention.

FIG. 2 conceptually illustrates a forwarding element that is onlyconnected to one VM and one physical NIC.

FIG. 3 conceptually illustrates the VM of FIG. 2 after the forwardingelement is bypassed in some embodiments of the invention.

FIGS. 4A and 4 B conceptually illustrate a process for determiningwhether a forwarding element can be bypassed in the path between a VMand a physical VIC in some embodiments of the invention.

FIG. 5 conceptually illustrates SR-IOV virtualization on a host in someembodiments of the invention.

FIG. 6 conceptually illustrates SR-IOV virtualization on a host in someembodiments of the invention where VMs that cannot bypass virtualizationsoftware stack are connected to a single SRI-OV enabled PNIC.

FIG. 7 conceptually illustrates SR-IOV virtualization of FIG. 6 whereeach VM is connected to a different VF through a separate forwardingelement.

FIG. 8 conceptually illustrates SR-IOV virtualization on a host in someembodiments of the invention where a VM that cannot bypassvirtualization software stack bypasses the forwarding element andconnects to a VF through a VNIC.

FIG. 9 conceptually illustrates a process for determining whether eachVMs on a host can be connected to a VF of an SR-IOV capable PNIC in someembodiments of the invention.

FIG. 10 conceptually illustrates a process for determining whether aforwarding element can be bypassed in the path between a VM and a VF ofan SR-My enabled PNIC in some embodiments of the invention.

FIG. 11 conceptually illustrates a process for dynamically determiningwhether to use polling or interrupts to send transmit packets from eachof a tenant's VMs to the virtualization software in some embodiments ofthe invention.

FIG. 12 conceptually illustrates a process for performing interruptcoalescing in some embodiments of the invention.

FIG. 13 conceptually illustrates a process performed by the VNIC whenthe virtualization software performs polling to determine theavailability of VM transmit packets in some embodiments of theinvention.

FIG. 14 conceptually illustrates a process performed by thevirtualization software in some embodiments to poll a VNIC to determinewhether transmit packets are available from the VM.

FIG. 15 conceptually illustrates an electronic system with which someembodiments of the invention are implemented.

DETAILED DESCRIPTION

In the following detailed description of the invention, numerousdetails, examples, and embodiments of the invention are set forth anddescribed. However, it will be clear and apparent to one skilled in theart that the invention is not limited to the embodiments set forth andthat the invention may be practiced without some of the specific detailsand examples discussed.

Virtualization is the ability to simulate a hardware platform, such as aserver, storage device or network resource, in software. A virtualmachine (VM) is a software implementation of a machine such as acomputer. FIG. 1 conceptually illustrates a virtualized infrastructuredomain in some embodiments of the invention. The virtualizedinfrastructure domain is in some embodiments a virtualizedinfrastructure that is managed by a single cloud management system. Thevirtualized infrastructure domain includes a set of host machines 101,one of which is shown in FIG. 1. Each host can host one or more tenants,each tenant can have one or more VMs 110 and 170. In FIG. 1, VMs 110belong to one tenant and VMs 170 belong to a different tenant. The hostmachines also host a set of services that provide different services.The term cloud service refers to services (such as computing, storage,etc.) provided in a distributed manner over a network.

As shown, the host 101 includes virtualization software (sometimesreferred to as a hypervisor) 115. The virtualization software 115 isrepresentative of the various types of virtualization software that mayoperate on hosts in such a virtualized infrastructure (e.g., virtualmachine monitor, etc.). In some embodiments, this virtualizationsoftware 115 includes one or more forwarding elements 105-107.

The VMs of each tenant form a logical network (also referred to asprivate network or virtual network). The logical network is identifiedby a logical network identifier (also known as virtual networkidentifier or VNI). Each logical network is configured by a tenant. Thelogical network is an abstraction of a physical network and may providea virtual Layer 2 (or data link layer) for services such asencapsulation and decapsulation of network layer data packets intoframes, frame synchronization, medial access control, etc. The logicalnetwork may span one or more physical networks and be organizedindependent of the underlying physical topology and organization of thephysical networks.

In some embodiments, the forwarding element in the virtualizationsoftware is a physical forwarding element (PFE) such as a virtualswitch. In the virtualization field, some refer to software switches asvirtual switches as these are software elements. However, in thisspecification, the software forwarding elements are referred to asphysical forwarding elements (PFEs), in order to distinguish them fromlogical forwarding elements (LFEs), which are logical constructs thatare not tied to the physical world. A PFE forwards packets in a physicalnetwork whether or not it is implemented in software while a LFEforwards packets in a logical network, which is logically decoupled orabstracted from the physical network. In other words, the softwareforwarding elements are referred to as PFEs because they exist andoperate in the physical world, whereas an LFE is a logicalrepresentation of a forwarding element that is presented to a user whendesigning a logical network.

In some embodiments, several PFEs are distributed throughout the networkimplement tenant's LFEs, where each PFE is a local instantiation, or aproxy, of an LFE that operate across different host machines and canperform L 3 packet forwarding between VMs on the host machine or ondifferent host machines. An LFE is sometimes referred to as a virtualdistributed switch (VDS). In the following discussions, the termforwarding element refers to either a PFE or an LFE, depending on aparticular configuration.

In each host 101, each forwarding elements 105-107 connects to one ormore physical network interface controllers (PNICs) 120 to send outgoingpackets and to receive incoming packets through a physical network 145.As shown, each forwarding element 105-107 in FIG. 1 is defined toinclude one or more ports 135 (or a port group 130) through which itconnects to uplinks 150 and the physical NICs 120 to send and receivepackets.

Each forwarding element 105-107 is also defined to have a set of virtualports 160 (or a virtual port group 140) to connect to VMs 110 throughvirtual NICs (VNICs) 125 to the forwarding element 105. A port group isa group of ports that have the same configuration. An uplink 150 is amodule that relays packets between the forwarding element 105 and thephysical NIC 120 in order to perform various packet processing functionson incoming and outgoing traffic.

I. Selective Bypassing or use of Forwarding Elements

Some embodiments identify a VM that consumes all traffic on a singlephysical network interface controller (PNIC) and is not sharing the PNICwith any other VMs. These embodiments provide a specialization of thevirtual device processing that bypasses the virtual switch layer andhook up the virtual device code with the physical code. Since there is asingle source port and a single destination port, any traffic anexternal switch routes to the PNIC reaches the VM and vice versa.

Bypassing the virtual switching layer reduces processing cost per packetby around 5%-10% and increases the packet processing abilityaccordingly. Bypassing of the virtual switch is a runtime decision. Oncea need arises for connecting the VM to the switch (e.g., when another VMis moved to the same host, port mirroring is needed to tap the packets,or any services the VM requires that needs the virtual switch), the VMis switched to use the virtual switch. The VM is transparently switchedbetween a fast path (no switching) and slow path (switching) to providethe required features of virtualization.

A. Criteria to Use or Bypass the Forwarding Element

FIG. 2 conceptually illustrates a forwarding element that is onlyconnected to one VM and one physical NIC. As shown, VM 210 is connectedto the forwarding element 205 through VNIC 225 and port 260. PNIC 220 isconnected to the forwarding element 205 through the uplink 250 and port235 of port group 230. Utilizing the forwarding element 205 to exchangepackets between VM 210 and PNIC 220 create extra processing overhead.

Some embodiment, dynamically identify the conditions where theforwarding element can be bypassed in the connection between a VM and aPNIC. These conditions include that only two ports of the switch areconnected: a port connected to a VM (through a VNIC) and a portconnected to an uplink. Another condition is that port mirroring/packetforwarding is not enabled for the switch. When port mirroring is enabledfor a forwarding element, a copy of each packet passing through a portis sent to another port (a port different than the port PNIC isconnected to) to monitor the packet traffic (e.g., to detect intrusion,to do performance monitoring, etc.). Under the above-mentionedconditions, the VM sends and receives packets through only one PNIC andthere is no need for port mirroring. As shown in FIG. 2, VM 210 and PNIC220 are the only entities connected to the forwarding element's ports.

FIG. 3 conceptually illustrates the VM of FIG. 2 after the forwardingelement is bypassed in some embodiments of the invention. As shown,there are no forwarding elements in the path between VM 210 and PNIC 220and a direct path (as conceptually shown by the line 305) is providedbetween the VNIC 225 and the uplink 250 to exchange packets between theVM 210 and the PNIC 220. The decision to bypass the forwarding elementis dynamically made during runtime when a set of conditions is met. Oncethe use of a forwarding element is required again, the packet exchangebetween the VM is the PNIC is once again performed through theforwarding element 205.

Different embodiments provide different mechanisms for bypassing theforwarding element. Since the forwarding element 205 is implemented insoftware, some embodiments provide a fast path through the forwardingelement software to bypass the functionality of the forwarding element.The following pseudo code illustrates bypassing of the forwardingelement functionality in some embodiments of the invention.

if all conditions for bypassing the forwarding element are satisfied   fastpath = TRUE else    fastpath = FALSE /*** Perform forwardingelement functionalities ***/ switching ( )    if fastpath then      return    else       {       /* perform forwarding elementfunctionalities */       }

In some embodiments, each time a VNIC is connected to a port, a callbackis generated to the virtualization software. Similarly, when a PNIC isconnected to a port through an uplink, a callback is generated to thevirtualization software. The virtualization software is therefore ableto determine the number of VNICs and PNICs that are connected to aforwarding element at each time.

Some embodiments bypass the forwarding element by providing a directsoftware link between the uplink and the VNIC driver for the durationthat the forwarding element is bypassed. In either case, only theforwarding element is bypassed in order to eliminate unnecessaryprocessing for the forwarding element while the virtualization softwareis still aware of the interactions between the VM and other componentsof the system and is capable of dynamically connecting the VM to thePNIC through the forwarding element once the need arises for the use ofthe forwarding element during the runtime.

From a security perspective, bypassing the forwarding element incombination with a vulnerability in the physical/upstream infrastructurecan allow the VM to receive packets from any other VMs. For a properdefense in depth implementation, some embodiments ensure that the VMport has proper security credentials before allowing bypass. As anadditional condition for allowing the bypassing of the forwardingelement, these embodiments determine whether the port that connects theVM to the forwarding element can send packets to arbitrary media accesscontrol (MAC) addresses and can receive packets with arbitrarydestination MAC addresses (promiscuous mode). Such a condition is notvery limiting as the forwarding element bypass is targeted towards highpacket rate applications and many such applications are gateway/edgeapplications and are able to receive and send arbitrary MAC addresspackets.

FIGS. 4A and 4B conceptually illustrate a process 400 for determiningwhether a forwarding element can be bypassed in the path between a VMand a physical NIC in some embodiments of the invention. As shown, theprocess initially uses (at 405) a forwarding element for exchangingpackets between the VM and the physical NIC. The process then determines(at 410) whether only two ports of the forwarding elements are used, oneport connecting to the VM (e.g., through a VNIC) and one port connectingto the physical NIC (e.g., through an uplink). If not, the processproceeds (e.g., after some predetermined delay) to 405, which wasdescribed above. For instance, more than two ports are used when the VMis required to be connected to more than one physical NIC or any otherVMs are connected to the forwarding element.

Otherwise, the process determines (at 420) whether port mirroring isenabled on the forwarding element. If yes, the process proceeds (e.g.,after some predetermined delay) to 405, which was described above.Otherwise, the process determines (at 425) whether there are any otherconditions that require the use of the forwarding element for exchangingpackets between the VM and the PNIC. For instance, some embodimentsdetermine whether the port connected to the VM has proper securitycredentials before allowing the bypass (e.g., whether the port can sendarbitrary MAC address packets and can receive arbitrary MAC addresspackets, i.e., to operate in promiscuous mode).

Another condition for bypassing a forwarding element is the networkvirtualization (e.g., tunnels for overlay networks such as VirtualeXtensible LAN (VXLAN), Generic Network Virtualization Encapsulation(GENEVE), Network Virtualization using Generic Routing Encapsulation(NVGRE), and stateless transport tunneling (STT)) is not performed bythe forwarding element. In other words, the forwarding element is not apart of a software-defined network. In some embodiments, the forwardingelement encapsulates the outgoing packets and decapsulates the incomingpackets. In such cases, the forwarding element cannot be bypassed due tothe required encapsulation/decapsulation functionality of the forwardingelement. In some embodiments, the encapsulation and decapsulation ofpackets for such tunnels is done outside of a forwarding element.

Therefore, the condition that the forwarding element does notencapsulate and decapsulate packets is satisfied either when theencapsulation and decapsulation of packets is done outside theforwarding element or the forwarding element is capable of encapsulatingand decapsulating the packets but such encapsulation and decapsulationis not enabled (e.g., the overlay network tunnels are not used by the VMthat is connected to the forwarding element). If there are any otherconditions that require the use of the forwarding element, the processproceeds (e.g., after some predetermined delay) to 405, which wasdescribed above. Otherwise, the process bypasses (at 430) the forwardingelement for exchanging packets between the VM and the physical NIC.

The process then dynamically determines whether the conditions havechanged and the forwarding element can no longer be bypassed. Theprocess determines (at 435) whether more than two ports of theforwarding element are being used. For instance, VM is required to beconnected to more than one physical NIC or any other VMs are connectedto the forwarding element. If yes, the process proceeds back to 405 touse the forwarding element for exchanging the packets between the VM andthe physical NIC.

Otherwise, the process determines (at 445) whether port mirroring isenabled on the forwarding element. If yes, the process proceeds back to405 to use the forwarding element for exchanging the packets between theVM and the physical NIC. Otherwise, the process determines (at 450)whether any other conditions (as described above by reference tooperation 425) exist that require the use of forwarding element forexchanging packets between the VM and the PNIC. If yes, the processproceeds back to 405 to use the forwarding element for exchanging thepackets between the VM and the physical NIC. Otherwise, the processproceeds (e.g., after some predetermined delay) back to 435 andcontinues to bypass the forwarding element for exchanging packetsbetween the VM and the physical NIC.

The decision for whether or not to perform the optimization of bypassingthe forwarding element is taken based on local data available on theparticular host that is implementing the optimization. The decision ismade based on the ports connected to forwarding element on theparticular host and types of features enabled for the connected ports.For instance, the decision to determine how many ports are connected tothe forwarding element is based on whether or not a VM on the particularhot is powered on. The VMs that are powered off are considered as notconnected to the forwarding element. On the other hand, when a link isdown for a PNIC, the PNIC is still considered as connected to theforwarding element. The decision whether port mirroring is enabled isbased on whether the port mirroring is enabled for the ports connectedto the forwarding element on the particular host. Therefore, even if theforwarding element is an LFE (which is a virtual distributed switch),local information are utilized to determined how many ports of theforwarding element is currently connected in order to make the decisionto bypass or use the forwarding element.

B. Bypassing the Forwarding Element in SR-IOV

Single Root input-output (I/O) Virtualization (SR-IOV) is aspecification that allows a single Peripheral Component InterconnectExpress (PCIe) physical device under a single root port to appear to bemultiple separate physical devices to the virtualization software or theguest operating system. SR-IOV uses physical functions (PFs) and virtualfunctions (VFs) to manage global functions for the SR-IOV devices.

PFs are full PCIe functions that include the SR-My extended capability,which is used to configure and manage the SR-IOV functionality. It ispossible to configure or control PCIe devices using PFs, and the PF hasfull ability to move data in and out of the device. VFs are lightweightPCIe functions that contain all the resources necessary for datamovement but have a minimized set of configuration resources. SR-IOVenabled PCIe devices present multiple instances of themselves to theguest operating system instance and the host virtualization software.

FIG. 5 conceptually illustrates SR-IOV virtualization on a host in someembodiments of the invention. The VMs of other tenants (if any) are notshown for simplicity. As shown, the SR-My capable PNIC 505 includesseveral VFs 510 and one PF 515. VMs 520 have a direct path to VFs 510.On the other hand, PF 515 is connected to several VMs 525-530 throughuplink 540, forwarding element 535, and VNICs 545.

The instantiated VFs 510 can be configured such that they are directlyassigned to VMs and the guest operating system's VF driver (not shown)takes possession of the VF. For instance, each VF can create a directpath from a VM to the physical NIC. While such configuration deliversnear native network performance to the VM, the data path bypasses thevirtualization software/network stack (i.e., the VFs are pass-throughdevices). Hence such VFs in those VMs are unable to benefit from anoverlay network based multi-tenant environment.

However, some or all VMs on a host may not be capable of using an SR-IOVVF in some embodiments. These VMs may need some virtualization featuresthat cannot be provided if the VM bypasses the virtualizationsoftware/network stack and is directly connected to a VF. For instance,a VM may require memory overcommit, which is a feature provided byvirtualization software that allows a VM to use more memory space thanthe physical host has available. As an example, on a host with 10 GB ofphysical memory, the virtualization software may allow 5 VMs, each with4 GB of allocated memory space to run a host with only 10 GB of physicalmemory. Some embodiments allow such VMs to still connect to a VF withoutbypassing the virtualization software stack.

FIG. 6 conceptually illustrates SR-IOV virtualization on a host in someembodiments of the invention where VMs that cannot bypass virtualizationsoftware stack are connected to a single SRI-OV enabled PNIC. VMs605-610 are VMs that require the services of software virtualization215. For instance, the VMs may require memory overcommit. As shown, eachof the k VMs 605-610 is associated with one VNIC 630-635. Each VNIC630-635 is connected to a port 680-685 of a single forwarding element690. The forwarding element 690 is connected to PF 515 of the PNIC 625through uplink 540. VMs 605-610 are VMs of one tenant. VMs of othertenants (if any) are on separate logical networks and are not shown.

Some of VFs on PNIC 625 may be utilized by the virtualization software215 to connect to kernel VNICs , referred to as VMKNICs (not shown). Ifthe PNIC 625 has n available VFs 650-655 and n>=k, then thevirtualization software 215 assigns k VFs from the PNIC 625 and treatseach of them as a new PNIC. The virtualization software also creates knew forwarding elements and attaches one VNIC and one VF to eachforwarding element. The VNICs are also detached from the original FE.

FIG. 7 conceptually illustrates SR-IOV virtualization of FIG. 6 whereeach VM is connected to a different VF through a separate forwardingelement. As shown, k VMs 605-610 that were previously (as shown in FIG.6) connected to a single forwarding element 690 are now connected to kseparate forwarding elements 715-720 through their associated VNICs630-635. Each forwarding element 715-720 is connected to one of the kVFs 650-652 of the RS-IOV enabled PNIC 625. The process of creation ofthe forwarding elements 715-720, connecting VNICs 630-635 to theforwarding elements, and connecting the forwarding elements to VFs650-652 is completely transparent to the VNICs and VMs in someembodiments.

Now there is a single uplink and a single VM connected to each of theforwarding elements 715-720 and whenever a set of conditions (asdescribed below) is satisfied, each of the forwarding elements 715-720can be bypassed. When the set of conditions fails, then all forwardingelements 715-720 are deleted and the VNICs are connected back to theforwarding element 690 (shown in FIG. 6), which frees all VFs 650-652.

Some embodiment, dynamically identify the condition where a forwardingelement 715-720 can be bypassed in the connection between a VNICs630-635 and a VFs 650-652. Since each forwarding element 715-720 isconnected to only one of the VNICs 630-635 and one of the VFs 650-652,the forwarding elements satisfy the condition that only two ports to beused on the forwarding element. Another condition for bypassing theforwarding element is that port mirroring is not enabled on theforwarding element.

As another condition, some embodiments determine (as described above byreference to operation 425) whether the port connected to the VNIC hasproper security credentials before allowing the bypass. Yet anothercondition for bypassing a forwarding element is the networkvirtualization (e.g., tunnels for overlay networks such as VXLAN,GENEVE, NVGRE, and STT) is not performed by the forwarding element. Insome embodiments, the forwarding element encapsulates the outgoingpackets and decapsulates the incoming packets. In such cases, theforwarding element cannot be bypassed due to the requiredencapsulation/decapsulation functionality of the forwarding element. Insome embodiments, the encapsulation and decapsulation of packets forsuch tunnels is done outside of a forwarding element.

Therefore, the condition that the forwarding element does notencapsulate and decapsulate packets is satisfied either when theencapsulation and decapsulation of packets is done outside theforwarding element or the forwarding element is capable of encapsulatingand decapsulating the packets but such encapsulation and decapsulationis not enabled (e.g., the overlay network tunnels are not used by the VMthat is connected to the forwarding element).

Another condition that prevents bypassing of the forwarding elements iswhen n+1 VMs are powered on and/or moved to the host, i.e., when thenumber of VMs becomes larger than the number of available VFs on thePNIC. For instance, as a new VM is powered on or a VM is moved (fromanother host) to the host, the networking layer in the host creates anew forwarding element for the VM and assigns one of the n VFs in theSR-My PNIC to the VM. Alternatively, an administrator can enable apreviously disabled VNIC to connect the VNIC to one of the VFs through aforwarding element. Eventually, the number of VMs on the host may becomelarger than the number of available VFs, which prevents bypassing of theforwarding elements.

FIG. 8 conceptually illustrates SR-IOV virtualization on a host in someembodiments of the invention where a VM that cannot bypassvirtualization software stack bypasses the forwarding element andconnects to a VF through a VNIC. As shown, the forwarding element 615 isbypassed for exchanging packets between VM 605 and VF 650. Asconceptually shown by line 805, there are no forwarding elements in thepath between VNIC 630 and VF 650. The path between the VM 605, VNIC 630,and VF 650, still goes through the virtualization software stack (asopposed to the paths between VMs 520 and VFs 510 in FIG. 5 that bypassthe virtualization software stack).

On the other hand, in the example of FIG. 7, the forwarding element 620does not satisfy all conditions for bypassing (e.g., port mirroring maybe enabled on the forwarding element or forwarding element may be usedto encapsulate/decapsulate packets for an overlay network). Forwardingelement 620, is therefore, not bypassed.

The decision whether or not to bypass a forwarding element to connect aVM and the corresponding VNIC directly to a VF is dynamically made insome embodiments. FIG. 9 conceptually illustrates a process 900 fordetermining whether each VMs on a host can be connected to a VF of anSR-IOV capable PNIC in some embodiments of the invention. As shown, theprocess connects (at 905) all VMs' VNICs through a single forwardingelement to a PF of an SR-IOV capable PNIC (e.g., as shown in FIG. 6).

The process then determines (at 910) whether the number of available VFson the PNIC is the same or larger than the number of VMs. If not, theprocess proceeds (e.g., after a predetermined delay) to 905, which wasdescribed above. Otherwise, the process creates (at 915) one forwardingelement for each VM. The process then connects (at 920) each forwardingelement to (i) the VNIC of the corresponding VM and (ii) one of thePNIC' s available VFs (e.g., as shown in FIG. 7)

As long as a set of conditions is satisfied for a forwarding element,the process bypasses (at 925) the forwarding element and connects theVM' s VNIC to the associated VF (e.g., as shown in FIG. 8). Details ofoperation 925 are further described by reference to FIG. 10, below. Theprocess then determines (at 930) whether the number of available VFs onthe PNIC is the same or larger than the number of VMs. If not, theprocess proceeds (e.g., after a predetermined delay) to 905 to connectall VNICs to a single forwarding element. Otherwise, the processproceeds (e.g., after a predetermined delay) to 920, which was describedabove.

FIG. 10 conceptually illustrates a process 1000 for determining whethera forwarding element can be bypassed in the path between a VM and a VFof an SR-IOV enabled PNIC in some embodiments of the invention. Asshown, the process initially uses (at 1005) a forwarding element forexchanging packets between the VM (and the VM's corresponding VNIC) anda VF of an SR-IOV enabled physical NIC. The process then determines (at1010) whether port mirroring is enabled on the forwarding element. Ifyes, the process proceeds (e.g., after some predetermined delay) to 805,which was described above. Otherwise, the process determines (at 1020)whether there are any other conditions that require the use of theforwarding element for exchanging packets between the VM and the PNIC.For instance, some embodiments determine whether the port connected tothe VM has proper security credentials before allowing the bypass (e.g.,whether the port can send arbitrary MAC address packets and can receivearbitrary MAC address packets, i.e., to operate in promiscuous mode).

Another condition for bypassing a forwarding element is the networkvirtualization is not performed by the forwarding element (as describedabove by reference to operation 425 in FIG. 4). In other words, theforwarding element is not a part of a software-defined network. If thereare any other conditions that require the use of the forwarding element,the process proceeds (e.g., after some predetermined delay) to 1005,which was described above. Otherwise, the process bypasses (at 1025) theforwarding element for exchanging packets between the VM and the VF(e.g., as shown for VM 605 in FIG. 8).

The process then dynamically determines whether the conditions havechanged and the forwarding element can no longer be bypassed. Theprocess determines (at 1030) whether port mirroring is enabled on theforwarding element. If yes, the process proceeds back to 1005 to use theforwarding element for exchanging the packets between the VM and thephysical NIC. Otherwise, the process determines (at 1035) whether anyother conditions (as described above by reference to operation 425)exist that require the use of forwarding element for exchanging packetsbetween the VM and the PNIC. If yes, the process proceeds back to 1005to use the forwarding element for exchanging the packets between the VMand the physical NIC. Otherwise, the process proceeds (e.g., after somepredetermined delay) back to 1030 and continues to bypass the forwardingelement for exchanging packets between the VM and the physical NIC.

In some embodiments, VM 605 can have more than one VNIC (not shown).Each of the VM' s VNICs can be connected to a separate forwardingelement. Similar to the example of FIG. 8, a VM with multiple VNICs canbypass any or all of the forwarding elements connected to it as long asall conditions (as described above) for bypassing the forwarding elementare satisfied.

SR-IOV PNICs have built in switches. As long as all VMs are assignedseparate VFs, the SR-IOV PNIC can be relied to do the switching.However, this path is more expensive than doing the switching with aforwarding element, but the optimization is more targeted towardspackets transiting through the SR-My PNIC.

As discussed by reference to FIGS. 3 and 8 above, a forwarding elementis dynamically bypassed under certain conditions. Different embodimentsprovide different mechanisms for bypassing the forwarding element. Someembodiments provide a fast path through the forwarding element softwareto bypass the functionality of the forwarding element. Other embodimentsbypass the forwarding element by providing a direct software linkbetween the uplink and the VNIC driver for the duration that theforwarding element is bypassed.

II. Selective use of Polling Instead of Interrupt Processing for HighPacket Rate Applications

Some embodiments identify applications that consistently have highpacket rates. These embodiments provide a tradeoff between theprocessing resources and higher packet rates. These embodiments modifyvirtual device processing to occur in polling mode rather then interrupt(or sys-call) driven mode. Streamlining virtual device processingprovides a two-fold advantage. First, packet processing does not incurany latency. Second, the virtual backend, virtual machine monitor, guestkernel, and guest device driver for the virtual network device do nothave to execute interrupt coalescing and interrupt processing code. Theprocessing overhead is reduced by 1%-2%, increasing packet processing bya similar amount. Some embodiments turn on/off the polling mode when aVNIC is initialized (e.g., at the time of VM boot or VNIC reset). Inother embodiments, the polling mode is adaptively turned on or offduring the runtime. In these embodiments, polling is turned on whenpacket rate is high and turns off polling when the packet rate is low.

Interrupt coalescing is a technique to hold back events that generateinterrupts until a certain amount of time passes or a certain about ofdata to process is collected. When a VM generates a packet to send out(a transmit packet), the VNIC deriver generates an interrupt (e.g., byperforming a call) to the virtualization software to inform thevirtualization software of the pending transmit packet. In someembodiments, the VNIC driver implements interrupt coalescing by keepingthe transmit packets in a buffer until a predetermined number oftransmit packets are received from the VM or a predetermined amount oftime since the last interrupt by the VNIC driver to the virtualizationsoftware has elapsed. In some embodiments, whichever of these twoconditions occur, the VNIC driver interrupts the virtualizationsoftware.

FIG. 11 conceptually illustrates a process 1100 for dynamicallydetermining whether to use polling or interrupts to send transmitpackets from each of a tenant's VMs to the virtualization software insome embodiments of the invention. In the following discussions, atransmit packet refers to a packet generated by the VM for transmissionto entities outside the VM. As shown, the process sets (at 1105) thecurrent VM to the tenant's first VM.

The process then determines (at 1110) whether the rate of packetsreceived at the VNIC from the VM is higher than a predeterminedthreshold. If yes, the process determines (at 1120) that polling betweenthe virtualization software and the current VM' s VNIC shall be used toindicate the availability of transmit packets received at the VNIC fromthe VM. The process then proceeds to 1125, which is described below.

Otherwise, the process determines (at 1115) that interrupts shall beused by the VM's VNIC to inform the virtualization software of theavailability of transmit packets received at the VNIC from the VM. Asdescribed below, some embodiments perform mechanisms such as interruptcoalescing to interrupt the virtualization software. The process thendetermines (at 1125) whether all VMs of the tenant are examined. If yes,the process proceeds to 1110, which was described above. Otherwise, theprocess sets (at 1130) the current VM to the tenant's next VM. Theprocess then proceeds to 1110, which was described above.

FIG. 12 conceptually illustrates a process 1200 for performing interruptcoalescing in some embodiments of the invention. As shown, the processdetermines (at 1205) whether packets are received from the VM. If not,the process returns (e.g., after a predetermined delay) to 1205).Otherwise, the process determines (at 1210) whether a predeterminednumber of packets is received from the VM. If yes, the process proceedsto 1220, which is described below.

Otherwise, the process determines (at 1215) whether a predeterminedamount of time has elapsed since the first packet currently in thebuffer has arrived. If no, the process proceeds to 1225, which isdescribed below. Otherwise, the process generates (at 1220) an interruptto the virtualization software and provides the location and the numberof packets that the virtualization software (e.g., the forwardingelement of the virtualization software) has to pick up from the bufferto transmit. In some embodiments, the interrupt is generated by acalling mechanism to virtualization software. For instance a hypercallis made from the VNIC driver to the virtualization software to generatea software trap to activate the transmit processing. The process thenproceeds to 1205, which was described above. The process saves (at 1225)the transmit packet in a buffer to inform the virtualization software ata later time. The process then proceeds to 1205, which was describedabove. Generation of an interrupt to virtualization software causes thevirtualization software to pick up the packets and reset the number ofpackets in the buffer to zero.

FIG. 13 conceptually illustrates a process 1300 performed by the VNICwhen the virtualization software performs polling to determine theavailability of VM transmit packets in some embodiments of theinvention. As shown, the process initializes (at 1305) a buffer forsaving VM transmit packets for pick up by the virtualization software.

The process then determines (at 1310) whether a transmit packet isreceived from the VM. If not, the process proceeds (e.g., after apredetermined time) to 1310. Otherwise, the process saves (at 1315) thetransmit packet in a buffer to be picked up by the virtualizationsoftware at a later time. The process then updates (at 1320) the numberof packets to pick up by the virtualization software. The process thenproceeds to 1310, which was described above.

FIG. 14 conceptually illustrates a process 1400 performed by thevirtualization software in some embodiments to poll a VNIC to determinewhether transmit packets are available from the VM. As shown, theprocess starts (at 1405) a timer to perform the next poll. The processthen determines (at 1410) whether it is time to poll the VNIC for theavailability of a VM transmit packet. For instance, the processdetermines whether the timer started at 1405 has expired.

If not, the process returns (at after a predetermined time delay) to1410. Otherwise, the process determines (at 1415) whether any VMtransmit packets are available in VNIC buffer to pick up (e.g., as setby process 1300 in operation 1315). If not, the process proceeds to1430, which is described below.

Otherwise, the process picks up (at 1420) the transmit packets from thebuffer. The process then initializes (at 1425) the buffer to be filledup by the VNIC. For instance, the process sets the number of packets inthe buffer to zero. The process then starts (at 1430) a timer forperforming the next poll. The process then proceeds to 1410, which wasdescribed above.

III. Electronic System

Many of the above-described features and applications are implemented assoftware processes that are specified as a set of instructions recordedon a computer readable storage medium (also referred to as computerreadable medium). When these instructions are executed by one or moreprocessing unit(s) (e.g., one or more processors, cores of processors,or other processing units), they cause the processing unit(s) to performthe actions indicated in the instructions. Examples of computer readablemedia include, but are not limited to, CD-ROMs, flash drives, RAM chips,hard drives, EPROMs, etc. The computer readable media does not includecarrier waves and electronic signals passing wirelessly or over wiredconnections.

In this specification, the term “software” is meant to include firmwareresiding in read-only memory or applications stored in magnetic storage,which can be read into memory for processing by a processor. Also, insome embodiments, multiple software inventions can be implemented assub-parts of a larger program while remaining distinct softwareinventions. In some embodiments, multiple software inventions can alsobe implemented as separate programs. Finally, any combination ofseparate programs that together implement a software invention describedhere is within the scope of the invention. In some embodiments, thesoftware programs, when installed to operate on one or more electronicsystems, define one or more specific machine implementations thatexecute and perform the operations of the software programs.

FIG. 15 conceptually illustrates an electronic system 1500 with whichsome embodiments of the invention are implemented. The electronic system1500 can be used to execute any of the control, virtualization, computemanager, network manager, or operating system applications describedabove. The electronic system 1500 may be a computer (e.g., a desktopcomputer, personal computer, tablet computer, server computer,mainframe, a blade computer etc.), phone, PDA, or any other sort ofelectronic device. Such an electronic system includes various types ofcomputer readable media and interfaces for various other types ofcomputer readable media. Electronic system 1500 includes a bus 1505,processing unit(s) 1510, a system memory 1520, a read-only memory (ROM)1530, a permanent storage device 1535, input devices 1540, and outputdevices 1545.

The bus 1505 collectively represents all system, peripheral, and chipsetbuses that communicatively connect the numerous internal devices of theelectronic system 1500. For instance, the bus 1505 communicativelyconnects the processing unit(s) 1510 with the read-only memory 1530, thesystem memory 1520, and the permanent storage device 1535.

From these various memory units, the processing unit(s) 1510 retrieveinstructions to execute and data to process in order to execute theprocesses of the invention. The processing unit(s) may be a singleprocessor or a multi-core processor in different embodiments.

The read-only-memory 1530 stores static data and instructions that areneeded by the processing unit(s) 1510 and other modules of theelectronic system. The permanent storage device 1535, on the other hand,is a read-and-write memory device. This device is a non-volatile memoryunit that stores instructions and data even when the electronic system1500 is off. Some embodiments of the invention use a mass-storage device(such as a magnetic or optical disk and its corresponding disk drive) asthe permanent storage device 1535.

Other embodiments use a removable storage device (such as a floppy disk,flash drive, etc.) as the permanent storage device. Like the permanentstorage device 1535, the system memory 1520 is a read-and-write memorydevice. However, unlike storage device 1535, the system memory is avolatile read-and-write memory, such a random access memory. The systemmemory stores some of the instructions and data that the processor needsat runtime. In some embodiments, the invention's processes are stored inthe system memory 1520, the permanent storage device 1535, and/or theread-only memory 1530. From these various memory units, the processingunit(s) 1510 retrieve instructions to execute and data to process inorder to execute the processes of some embodiments.

The bus 1505 also connects to the input and output devices 1540 and1545. The input devices enable the user to communicate information andselect commands to the electronic system. The input devices 1540 includealphanumeric keyboards and pointing devices (also called “cursor controldevices”). The output devices 1545 display images generated by theelectronic system. The output devices include printers and displaydevices, such as cathode ray tubes (CRT) or liquid crystal displays(LCD). Some embodiments include devices such as a touchscreen thatfunction as both input and output devices.

Finally, as shown in FIG. 15, bus 1505 also couples electronic system1500 to a network 1525 through a network adapter (not shown). In thismanner, the computer can be a part of a network of computers (such as alocal area network (“LAN”), a wide area network (“WAN”), or an Intranet,or a network of networks, such as the Internet. Any or all components ofelectronic system 1500 may be used in conjunction with the invention.

Some embodiments include electronic components, such as microprocessors,storage and memory that store computer program instructions in amachine-readable or computer-readable medium (alternatively referred toas computer-readable storage media, machine-readable media, ormachine-readable storage media). Some examples of such computer-readablemedia include RAM, ROM, read-only compact discs (CD-ROM), recordablecompact discs (CD-R), rewritable compact discs (CD-RW), read-onlydigital versatile discs (e.g., DVD-ROM, dual-layer DVD-ROM), a varietyof recordable/rewritable DVDs (e.g., DVD-RAM, DVD-RW, DVD+RW, etc.),flash memory (e.g., SD cards, mini-SD cards, micro-SD cards, etc.),magnetic and/or solid state hard drives, read-only and recordableBlu-Ray® discs, ultra density optical discs, any other optical ormagnetic media, and floppy disks. The computer-readable media may storea computer program that is executable by at least one processing unitand includes sets of instructions for performing various operations.Examples of computer programs or computer code include machine code,such as is produced by a compiler, and files including higher-level codethat are executed by a computer, an electronic component, or amicroprocessor using an interpreter.

While the above discussion primarily refers to microprocessor ormulti-core processors that execute software, some embodiments areperformed by one or more integrated circuits, such as applicationspecific integrated circuits (ASICs) or field programmable gate arrays(FPGAs). In some embodiments, such integrated circuits executeinstructions that are stored on the circuit itself.

As used in this specification, the terms “computer”, “server”,“processor”, and “memory” all refer to electronic or other technologicaldevices. These terms exclude people or groups of people. For thepurposes of the specification, the terms display or displaying meansdisplaying on an electronic device. As used in this specification, theterms “computer readable medium,” “computer readable media,” and“machine readable medium” are entirely restricted to tangible, physicalobjects that store information in a form that is readable by a computer.These terms exclude any wireless signals, wired download signals, andany other ephemeral or transitory signals.

While the invention has been described with reference to numerousspecific details, one of ordinary skill in the art will recognize thatthe invention can be embodied in other specific forms without departingfrom the spirit of the invention. In addition, a number of the figuresincluding FIGS. 4A-4B and 9-14 conceptually illustrate processes. Thespecific operations of these processes may not be performed in the exactorder shown and described. The specific operations may not be performedin one continuous series of operations, and different specificoperations may be performed in different embodiments. Furthermore, theprocess could be implemented using several sub-processes, or as part ofa larger macro process.

This specification refers throughout to computational and networkenvironments that include virtual machines (VMs). However, virtualmachines are merely one example of data compute nodes (DCNs) or datacompute end nodes, also referred to as addressable nodes. DCNs mayinclude non-virtualized physical hosts, virtual machines, containersthat run on top of a host operating system without the need for ahypervisor or separate operating system, and hypervisor kernel networkinterface modules.

VMs, in some embodiments, operate with their own guest operating systemson a host using resources of the host virtualized by virtualizationsoftware (e.g., a hypervisor, virtual machine monitor, etc.). The tenant(i.e., the owner of the VM) can choose which applications to operate ontop of the guest operating system. Some containers, on the other hand,are constructs that run on top of a host operating system without theneed for a hypervisor or separate guest operating system. In someembodiments, the host operating system uses name spaces to isolate thecontainers from each other and therefore provides operating-system levelsegregation of the different groups of applications that operate withindifferent containers. This segregation is akin to the VM segregationthat is offered in hypervisor-virtualized environments that virtualizesystem hardware, and thus can be viewed as a form of virtualization thatisolates different groups of applications that operate in differentcontainers. Such containers are more lightweight than VMs.

Hypervisor kernel network interface module, in some embodiments, is anon-VM DCN that includes a network stack with a hypervisor kernelnetwork interface and receive/transmit threads. One example of ahypervisor kernel network interface module is the vmknic module that ispart of the ESXi™ hypervisor of VMware, Inc.

One of ordinary skill in the art will recognize that while thespecification refers to VMs, the examples given could be any type ofDCNs, including physical hosts, VMs, non-VM containers, and hypervisorkernel network interface modules. In fact, the example networks couldinclude combinations of different types of DCNs in some embodiments.

In view of the foregoing, one of ordinary skill in the art wouldunderstand that the invention is not to be limited by the foregoingillustrative details, but rather is to be defined by the appendedclaims.

What is claimed is:
 1. A method of high packet rate network processingin a system comprising a physical host and a set of physical networkinterface controllers (PNICs), the physical host hosting a set of datacompute nodes (DCNs) for each of a set of tenants, each DCN comprising avirtual network interface controller (VNIC) for communicating with oneor more PNICs to exchange packets, the method comprising: determiningwhether a predetermined number of packets have been received at a VNICfrom a particular DNC; when the predetermined number of packets havebeen received at the VNIC from the particular DNC, generate an interruptto the virtualization software; and when the predetermined number ofpackets have not been received at the VNIC from the particular DNC:determining a rate of packets received from the particular DCN at theVNIC; and when the rate of packets exceeds the predetermined threshold,performing polling to determine the availability of packets received atthe VNIC from the particular DCN; and when the rate of packets does notexceed the predetermined threshold, utilizing interrupts to determinethe availability of packets received at the VNIC from the particularDCN.
 2. The method of claim 1, wherein the physical host comprisesvirtualization software, wherein performing polling to determine theavailability of packets received at the VNIC from the particular DCNcomprises: determining, by the VNIC, that a packet is received from theparticular DCN; storing the packet in a buffer for the virtualizationsoftware to pick up; and updating a number of packets in the buffer. 3.The method of claim 2, wherein performing polling further comprises:determining, by the virtualization software, that the VNIC has to bepolled; and determining whether the VNIC has stored any packets in thebuffer.
 4. The method of claim 3, further comprising: picking up packetsfrom the buffer by the virtualization software; and setting the numberof packets in the buffer to zero.
 5. The method of claim 4, furthercomprising starting a timer by the virtualization software to perform anext poll to determine the availability of packets received from theparticular DCN at the VNIC.
 6. The method of claim 1, wherein thephysical host comprises virtualization software, and wherein the methodfurther comprises generating an interrupt to the virtualization softwareto inform the virtualization software that packets have arrived from theparticular DCN when a predetermined number of packets have arrived atthe VNIC from the particular DCN.
 7. The method of claim 1, wherein thephysical host comprises virtualization software, and wherein the methodfurther comprises generating an interrupt to the virtualization softwareto inform the virtualization software that packets have arrived from theparticular DCN when a predetermined number of packets have arrived atthe VNIC from the particular DCN.
 8. A non-transitory machine-readablemedium storing a program for of high packet rate network processing in asystem comprising a physical host and a set of physical networkinterface controllers (PNICs), the physical host hosting a set of datacompute nodes (DCNs) for each of a set of tenants, each DCN comprising avirtual network interface controller (VNIC) for communicating with oneor more PNICs to exchange packets, the program executable by at leastone processing unit, the program comprising sets of instructions for:determining whether a predetermined number of packets have been receivedat a VNIC from a particular DNC; when the predetermined number ofpackets have been received at the VNIC from the particular DNC, generatean interrupt to the virtualization software; and when the predeterminednumber of packets have not been received at the VNIC from the particularDNC: determining a rate of packets received from the particular DCN atthe VNIC; and when the rate of packets exceeds the predeterminedthreshold, performing polling to determine the availability of packetsreceived at the VNIC from the particular DCN; and when the rate ofpackets does not exceed the predetermined threshold, utilizinginterrupts to determine the availability of packets received at the VNICfrom the particular DCN.
 9. The non-transitory machine-readable mediumof claim 8, wherein the physical host comprises virtualization software,and wherein the sets of instructions for performing polling to determinethe availability of packets received at the VNIC from the particular DCNcomprises sets of instructions for: determining, by the VNIC, that apacket is received from the particular DCN; storing the packet in abuffer for the virtualization software to pick up; and updating a numberof packets in the buffer.
 10. The non-transitory machine-readable mediumof claim 9, wherein the sets of instructions for performing pollingfurther comprises sets of instructions for: determining, by thevirtualization software, that the VNIC has to be polled; and determiningwhether the VNIC has stored any packets in the buffer.
 11. Thenon-transitory machine-readable medium of claim 10, wherein the programfurther comprises sets of instructions for: picking up packets from thebuffer by the virtualization software; and setting the number of packetsin the buffer to zero.
 12. The non-transitory machine-readable medium ofclaim 11, wherein the program further comprises sets of instructions forstarting a timer by the virtualization software to perform a next pollto determine the availability of packets received from the particularDCN at the VNIC.
 13. The non-transitory machine-readable medium of claim8, wherein the physical host comprises virtualization software, andwherein the program further comprises sets of instructions for:utilizing interrupts to determine an availability of packets received atthe VNIC from the particular DCN; and generating an interrupt to thevirtualization software to inform the virtualization software thatpackets have arrived from the particular DCN when a predetermined numberof packets have arrived at the VNIC from the particular DCN.
 14. Thenon-transitory machine-readable medium of claim 8, wherein the physicalhost comprises virtualization software, and wherein the program furthercomprises sets of instructions for: utilizing interrupts to determinethe availability of packets received at the VNIC from the particularDCN; and generating an interrupt to the virtualization software toinform the virtualization software that packets have arrived from theparticular DCN when the predetermined number of packets have arrived atthe VNIC from the particular DCN.
 15. A physical computing devicecomprising: a set of processing units; and a non-transitorymachine-readable medium storing a program for execution by the set ofprocessing units, the physical computing device hosting a set of datacompute nodes (DCNs) for each of a set of tenants, each DCN comprising avirtual network interface controller (VNIC) for communicating with oneor more PNICs to exchange packets, the sets of instructions for:determining whether a predetermined number of packets have been receivedat a VNIC from a particular DNC; when the predetermined number ofpackets have been received at the VNIC from the particular DNC, generatean interrupt to the virtualization software; and when the predeterminednumber of packets have not been received at the VNIC from the particularDNC: determining a rate of packets received from the particular DCN atthe VNIC; and when the rate of packets exceeds the predeterminedthreshold, performing polling to determine the availability of packetsreceived at the VNIC from the particular DCN; and when the rate ofpackets does not exceed the predetermined threshold, utilizinginterrupts to determine the availability of packets received at the VNICfrom the particular DCN.
 16. The physical computing device of claim 15,wherein the physical host comprises virtualization software, wherein theset of instructions for performing polling to determine the availabilityof packets received at the VNIC from the particular DCN comprises setsof instructions for: determining by the VNIC that a packet is receivedfrom the particular DCN; storing the packet in a buffer for thevirtualization software to pick up; and updating a number of packets inthe buffer.
 17. The physical computing device of claim 16, wherein theset of instructions for performing polling further comprises sets ofinstructions for: determining, by the virtualization software, that theVNIC has to be polled; and determining whether the VNIC has stored anypackets in the buffer.
 18. The physical computing device of claim 17,wherein the program further comprises sets of instructions for: pickingup packets from the buffer by the virtualization software; and settingthe number of packets in the buffer to zero.
 19. The physical computingdevice of claim 18, wherein the program further comprises a set ofinstructions for starting a timer by the virtualization software toperform a next poll to determine an availability of packets receivedfrom the particular DCN at the VNIC.
 20. The physical computing deviceof claim 15, wherein the physical host comprises virtualizationsoftware, and wherein the program further comprises a set ofinstructions for; utilizing interrupts to determine an availability ofpackets received at the VNIC from the particular DCN; and generating aninterrupt to the virtualization software to inform the virtualizationsoftware that packets have arrived from the particular DCN when thepredetermined number of packets have arrived at the VNIC from theparticular DCN.